package com.imooc.activitiweb.listener;


import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.ExecutionListener;
import org.activiti.engine.delegate.Expression;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 执行监听 器
 *
 * @author jzwu
 * @since 2021/3/21 0021
 */
public class PiListener implements ExecutionListener {
    private static final Logger LOGGER = LoggerFactory.getLogger(PiListener.class);
    /* sendType可以拿到前端的值了 */
    private Expression sendType;

    @Override
    public void notify(DelegateExecution execution) {
        LOGGER.info("流程执行名称：{}", execution.getEventName());
        LOGGER.info("流程定义ID：{}", execution.getProcessDefinitionId());
        if ("start".equals(execution.getEventName())) {
            //  记录开始时间
        } else if ("end".equals(execution.getEventName())) {
            // 记录结束时间
        }
        LOGGER.info("sendType:{}", sendType.getValue(execution).toString());
    }
}